﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace CppTestTool
{
    /// <summary>
    /// MakeCout.xaml 的交互逻辑
    /// </summary>
    public partial class MakeCout : UserControl
    {
        public MakeCout()
        {
            InitializeComponent();
        }
        public static string maketestString = "";
        private void makecout_Click(object sender, RoutedEventArgs e)
        {
            resultText.Text = "";
            maketestString = "";
            if (leixing.SelectedIndex==0)
            {


                Int64 count = Int64.Parse(shuliang.Text);//.Parse(shuliang.Text);
                Int64 minRange = Int64.Parse(qujian1.Text);
                Int64 maxRange = Int64.Parse(qujian2.Text);

                Random random = new Random();
                for (int i = 0; i < count; i++)
                {
                    //Int64 randomInt = random.(minRange, maxRange + 1); // 包括最大值
                    Int64 randomInt = random.Next((int)minRange, (int)maxRange + 1); // 不包括最大值long randomNumber = (long)(random.NextDouble() * range) + min;
                    maketestString += randomInt.ToString() + " ";
                }

                resultText.Text = maketestString;
            }
            else
            {
                int count = int.Parse(shuliang.Text);
                double minRange = double.Parse(qujian1.Text);
                double maxRange = double.Parse(qujian2.Text);

                Random random = new Random();
                for (int i = 0; i < count; i++)
                {
                    double randomDouble = random.NextDouble() * (maxRange - minRange) + minRange;
                    maketestString += randomDouble.ToString() + " ";
                }

                resultText.Text = maketestString;

            }


        }
    }
}
